package com.itheima.advantagesup.mapper;

import com.itheima.advantagesup.entity.SysMenu;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * SysMenuMapper
 *
 * @author liliudong
 * @version 1.0
 * @description
 * @date 2023/7/26 17:57
 */
@Mapper
public interface SysMenuMapper {
    /**
     * 选择列表按角色id
     *
     * @param roleIds 角色ids
     * @return {@link List}<{@link SysMenu}>
     */
    List<SysMenu> selectListByRoleIds(List<String> roleIds);

    List<SysMenu> findAllMenu();

    @Insert("insert into sys_menu(pid, path, component, title, icon, is_show, is_cache, is_link, redirect, create_date, update_date,type, sort, mark) " +
            "VALUES(#{pid},#{path},#{component},#{title},#{icon},#{isShow},#{isCache},#{isLink},#{redirect},#{createDate},#{updateDate},#{type},#{sort},#{mark})")
     void AddMenu(SysMenu sysMenu);
@Delete("delete from sys_menu where id=#{id}")
    void DeleteId(Integer id);
@Select("select * from sys_menu where id=#{id}")
    SysMenu findById(Integer id);

    void updateById(SysMenu sysMenu);
}
